<!--{template common/header_simple_start}-->
<link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all">
<script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script>
<style>
.thumbnails li {
	float: left;
}
.thumbnail {
	border: none;
	box-shadow: none;
}
.progress-title {
	word-break: break-all;
	font-weight: normal;
	max-height: 40px;
	line-height: 20px;
	overflow: hidden;
}
#upload_progress .back {
	position: absolute;
	width: 200px;
	text-align: center;
	color: #900;
	font-weight: bold;
}
#upload_progress .back span {
	padding: 0 5px;
}
</style>
<!--{template common/header_simple_end}-->
<!--{template common/commer_header}-->
<div class="bs-container clearfix">
  <div class="bs-left-container  clearfix"> 
    <!--{template left}--> 
  </div>
  <div class="left-drager">
  </div>
  <div class="bs-main-container  clearfix" style="min-width:570px;">
    <div class="main-header "> 
      <!--{template right_header}--> 
    </div>
    <div class="main-content clearfix" style="padding:20px 20px 10px;border-top:1px solid #FFF">
      <div class="clearfix" style="margin:0 auto">
        <p id="operation" class="text-center" style="width:500px;">
          <button class="btn btn-success start" onclick="moveing_start('start')">{lang starting_migration}</button>
          &nbsp; &nbsp;
          <button class="btn btn-danger stop" onclick="moveing_start('stop')" disabled="disabled">{lang stop}</button>
          &nbsp; &nbsp; </p>
        <ul class="thumbnails list-unstyled clearfix" style="width:570px;">
          <li id="source_space" style="width:150px;">
            <div class="thumbnail"> 
              <!--{if $sourcedata[bz]=='dzz'}--> 
              <img src="dzz/images/default/system/home.png" width="100"> 
              <!--{else}--> 
              <img src="dzz/images/default/system/$sourcedata[bz].png" width="100"> 
              <!--{/if}-->
              <h5 class="text-center" style="line-height:20px;margin-bottom:5px"><a href="javascript:;" title="$sourcedata[name]">$sourcedata[name] </a></h5>
            </div>
          </li>
          <li id="moveinfo">
            <div id="upload_progress" style="width:200px;overflow:hidden">
              <h5 class="progress-subject" style="margin-top:5px"></h5>
              <h5 class="progress-title">$first[attachment]</h5>
              <div class="progress progress-striped active">
                <div class="back"><span id="moved">$first[fsize]</span>/<span>$fmovesize</span></div>
                <div class="progress-bar" style="width:1%;"></div>
              </div>
            </div>
          </li>
          <li id="target_space" style="width:150px;">
            <div class="thumbnail"> 
              <!--{if $targetdata[bz]=='dzz'}--> 
              <img src="dzz/images/default/system/home.png" width="100"> 
              <!--{else}--> 
              <img src="dzz/images/default/system/$targetdata[bz].png" width="100"> 
              <!--{/if}-->
              <h5 class="text-center" style="line-height:20px;margin-bottom:5px"><a href="javascript:;" title="$targetdata[name]">$targetdata[name]</a></h5>
            </div>
          </li>
        </ul>
      </div>
      <div class="tip" style="margin:10px;">
        <div class="alert alert-warning">
          <button type="button" class="close" data-dismiss="alert">&times;</button>
          <h5>{lang board_message}</h5>
          <ul>
            {lang cloud_movetool_board_message_text1}
          </ul>
        </div>
      </div>
    </div>
  </div>
</div>
<iframe id="hideframe" name="hideframe" src="about:blank" frameborder="0" marginheight="0" marginwidth="0" width="0" height="0" allowtransparency="true" style="display:none;z-index:-99999"></iframe>
<script type="text/javascript">
	jQuery('.left-drager').leftDrager_layout();
	var runurl = '$runurl';
	var sizemoved = 0;
	var totalsize = parseInt('$movesize');
	var ignore = [];
	var ignore_attach = {};
	var attach = {};
	var ignoreTimer = null;

	function setProgress(data) {
		attach = data;
		var el = jQuery('#upload_progress');
		if(data.error) {
			el.find('.progress-title').html(data.attachment);
			var html = '';
			html += '<p><span class="text-danger">' + data.error + '</span></p>';
			html += '<p><span class="text-info">{lang filename}：' + data.attachment + '</span>';
			html += '<p><span class="text-info">{lang big_small}：' + formatSize(data.filesize) + '</span></p>';
			html += '<p><a href="javascript:;" onclick="moveing_start(\'retry\')">{lang founder_upgrade_reset}</a>&nbsp;&nbsp;<a href="javascript:;" onclick="moveing_start(\'ignore\');">{lang ignore_continue}</a></p>';
			ignoreTimer = window.setTimeout(function() { moveing_start('ignore'); }, 1000);
			el.find('.progress-subject').html(html);
		} else {
			el.find('.progress-subject').html('{lang moving}');
			sizemoved += parseInt(data.filesize);
			el.find('.progress-title').html(data.attachment);
			el.find('#moved').html(formatSize(sizemoved));
			jQuery('#upload_progress .progress-bar').css('width', Math.floor((sizemoved / totalsize) * 100));
		}

	}

	function setComplete() {
		var html = '';
		html += '<p><span class="text-success">{lang migration_completed}</span></p>';
		if(ignore.length > 0) {
			html += '<p class="text-warning">' + ignore.length + '{lang cloud_movetool_file_neglect}</p>';
		}
		jQuery('#upload_progress .progress-bar').css('width', '100%');
		jQuery('#upload_progress .progress-subject').html(html);
		jQuery('#operation .stop').attr('disabled', true);
		jQuery('#operation .start').attr('disabled', true);
	}

	function moveing_start(op) {
		if(ignoreTimer) window.clearTimeout(ignoreTimer);
		if(op == 'start') {
			jQuery('#operation .stop').removeAttr('disabled');
			jQuery('#operation .start').attr('disabled', true);
			jQuery('#upload_progress .progress-subject').html('{lang moving}');
			jQuery('#upload_progress .progress-bar').css('width', Math.floor((sizemoved / totalsize) * 100));
			window.frames['hideframe'].location = runurl ;
		} else if(op == 'stop') {
			jQuery('#operation .start').removeAttr('disabled');
			jQuery('#operation .stop').attr('disabled', true);
			window.frames['hideframe'].location = 'about:blank';
			jQuery('#upload_progress .progress-subject').html('{lang stopped}');
		} else if(op == 'ignore') {
			ignore.push(attach.aid);
			ignore_attach[attach.aid] = attach;
			jQuery('#upload_progress .progress-subject').html('{lang ignored}');
			sizemoved += parseInt(attach.filesize);
			jQuery('#upload_progress .progress-bar').css('width', Math.floor((sizemoved / totalsize) * 100));
			window.frames['hideframe'].location = runurl+'&dateline='+attach.dateline+'&aid1='+attach.aid ;
		} else if(op == 'retry') {
			jQuery('#upload_progress .progress-subject').html('{lang are_retry}');
			jQuery('#upload_progress .progress-bar').css('width', Math.floor((sizemoved / totalsize) * 100));
			window.frames['hideframe'].location = runurl ;
		} else if(op == 'refresh') {
			window.location.reload();
		}
	}

	function formatSize(bytes) {
		var i = -1;
		do {
			bytes = bytes / 1024;
			i++;
		} while (bytes > 99);

		return Math.max(bytes, 0).toFixed(1) + ['kB', 'MB', 'GB', 'TB', 'PB', 'EB'][i];
	};
</script> 
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
<!--{template common/footer_simple}-->